/**
 * 
 */
package leetCode;

import java.util.HashMap;

/**
 * @author zhongfang
 *
 */
public class JudgeRouteCircle {
	    public boolean judgeCircle(String moves) {
	        int upCount=0,rightCount=0;
	        for (int i = 0; i < moves.length(); i++) {
	        	char ch=moves.charAt(i);
	        	switch (ch) {
				case 'R':
					rightCount++;
					break;
				case 'L':
					rightCount--;
					break;
				case 'U':
					upCount++;
					break;
				case 'D':
					upCount--;
					break;
				default:
					break;
				}
			}
	        if(rightCount==0&&upCount==0){
	    		return true;
	    	}
	        return false;
	    }
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String moves="LL";
		System.out.println(new JudgeRouteCircle().judgeCircle(moves));
	}

}
